Skip to content

docs: design the ATOMesh RL rollout control plane (#77) - #98

Merged
junyyang-amd merged 2 commits into
RLfrom
task-77
Nov 17, 2026
Merged

junyyang-amd merged 2 commits into
RLfrom
task-77

Conversation

@junyyang-amd

@junyyang-amd junyyang-amd commented Nov 17, 2026 •

Copy link
Copy Markdown
Owner

Closes #77. Ready for review. No blocking issues.

The design every later task under #76 is planned from: ATOMesh's /v1/rl/* routes on SMG's protocol, the ATOM engine routes behind them, and the PD in-flight policy, with an acceptance table for A1 to A9.

Dev record

  • Found: SMG's trainer sends update_weights_from_distributed in chunks, and WeightUpdaterMixin.update_weights clears packed FP8 shards after every call; bf16 acceptance models are unaffected. Filed as update_weights drops packed FP8 shards split across calls of one refit #97 (backlog).
  • Found: ATOMesh discovers only model_path for ATOM workers, so a trainer reading tp_size from /v1/rl/workers would lay out TP2 ranks wrong; the design adds them from /server_info.
  • Decided: the PD policy stamps each handoff with P's weight_version; on a mismatch D frees the table and prefills locally (_recompute_stale_remote_kv), departing from the abort a failed P/D receive takes. A P/D engine refuses an update while unpaused or naming its current version, and refuses resume after a version-less update until a new version arrives.
  • Decided: /model_info reads the version through a utility command; /generate reads it from RequestOutput.weight_version, so both work with --api-server-count above 1.
  • Decided: A9 runs mooncake over tcp, not blocked on Mooncake RDMA on g24 leaves D's KV unwritten: 1P1D decodes garbage after the first token #95; /get_weight_version is not served, as in SMG's examples.
  • Left undone: none.

Named result

The acceptance table in docs/atomesh_rl_control_plane.md (Summary, Acceptance): one row per item A1 to A9 with its delivering modules and its python3 tools/rl/accept.py <check> command.

Gates

task-77 @ 968c6fe: gate_task passed (black, ruff on changed lines, 13757 passed and 1477 skipped in the CPU suite, mesh cargo tests). Documentation only; no new tests.

Evidence

Line count at head (line_count.py fork/RL): code 695 added (design 653, principles 40, index 2), 0 moved, 0 deleted; tests 0. Brief estimate about 500; a design task is exempt from the overrun rule.

Design loop log: /share_nfs/junyan_tmp_r120/rl/scratch/77/atomesh-rl-control-plane.grill.md (scratch).

🤖 Generated with Claude Code

…ine's principles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd junyyang-amd added the agent-team/design Design task (agent-team) label Nov 17, 2026
@junyyang-amd

Copy link
Copy Markdown
Owner Author

Round 1 pushed 0a1ce4e.

  • First round: the design, the principles document and their index lines in CLAUDE.md. Gate passed at this head.

Comment thread docs/atomesh_rl_control_plane.md Outdated
carries it to D in `kv_transfer_params`
(`core/placement/backend/atom.rs: AtomAdapter::enrich_decode_kv` adds
fields and keeps the rest).
2. D's `Scheduler._resolve_waiting_remote_kv` compares the stamp after the

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rule 2's path does not free blocks or prefill from scratch: _consume_failed_remote_kv is the offload failed_loading path and resumes over the kept table from num_cached_tokens, which covers D's local hit that its refit zeroed. A P/D receive failure aborts today (_abort_failed_remote_receive: decode is not sized for local prefill). Name the mismatch's own path and the conflict with that rule.

Comment thread docs/atomesh_rl_control_plane.md Outdated
transfer finish as today, then decodes on the received KV only when the
stamp equals its own version, and otherwise prefills the request itself. A
refit under PD must name a new `weight_version`, since the stamp is the only
thing that tells old KV from new.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Must name a new weight_version" has no enforcer, and without it D decodes P's pre-refit KV whenever the two stamps match, which breaks goal 3. Say who refuses it: for example the engine answers 400 to a weight update under a PD connector whose weight_version is absent or equal to its current one.

Comment thread docs/atomesh_rl_control_plane.md Outdated
participant P as ATOM prefill
participant D as ATOM decode
H->>M: 64 concurrent completions (in flight)
H->>M: fan-out pause_generation {} (no selector filter: P and D)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SMG's fan-out answers 400 selector_required without a selector (crates/rl/src/fanout.rs). Say the selector the check passes, e.g. engine=atom, which matches P and D.

Comment thread docs/atomesh_rl_control_plane.md Outdated

### D4. A8's selector

A8 passes `--selector engine=atom`. Settled by the

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This decision has no rival and restates the Ruling on #77. Cite the Ruling in A8's scenario and drop the decision.

Comment thread docs/atomesh_rl_control_plane.md Outdated

The scheduler holds the engine's version string: `--weight-version`
(default `"default"`), replaced when a committed update names one.
`/generate` `meta_info.weight_version` and `/model_info` report it.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The version lives in the EngineCore process, but /model_info and /generate answer from the API server, and with --api-server-count above 1 from a front-end worker. Say how each reads it: a utility command, or the committed update's reply carrying the version to the API side, and which version a request in flight across a refit reports.

@junyyang-amd

Copy link
Copy Markdown
Owner Author

REQUEST CHANGES @ 0a1ce4e: 2 blocking.

Both blocking findings are on the PD in-flight policy, inline: its stamp-mismatch path names Scheduler._consume_failed_remote_kv, which keeps D's zeroed blocks, while a P/D receive failure aborts today (_abort_failed_remote_receive); and the new-weight_version precondition has no enforcer. Three non-blocking findings are inline too.

Checked: 1 to 10 (detail below); gate passed at the head: black, ruff, 13757 passed and 1477 skipped, mesh cargo tests ok.

Accepted with reservation: the launch profile is documented flags rather than a default --enable-rl sets; each trainer chunk over HTTP is its own committed sync.

Watch next: the P stamp must be the version the prefill ran under; the chunked-transfer relay sends D the request before P's stamp exists; D with no stamp takes today's path.

Checks
  1. No low entries; the trainer group and PD policy rest on spikes Spike: does a second RCCL group with an external trainer work beside ATOM's TP group #91 and Spike: what happens to in-flight 1P1D requests when P and D are paused and their weights changed #92, and the stamp beats drain and stampless recompute.
  2. A diagram for each of A1 to A9; A9's walk fails at the mismatch step.
  3. The named simpler design fails A1, A8 and A9; mine matches this one except the PD policy.
  4. The PD policy contradicts the in-code abort rule without naming it; nothing else conflicts.
  5. Every code: basis holds at fork/RL 2f9d30a except the mismatch path.
  6. Every decision has a basis; SMG and SGLang references resolve at the pinned commits.
  7. Within ATOMesh RL rollout control plane (pause / refit / resume, weight_version) #76; no requirement gap.
  8. Spike results match the Spike: does a second RCCL group with an external trainer work beside ATOM's TP group #91 and Spike: what happens to in-flight 1P1D requests when P and D are paused and their weights changed #92 handoffs; upstream main has no RL work, so no sync issue.
  9. 603 lines, mostly what the exit criteria require; the A8 selector decision has no rival.
  10. Gate as above; principles match the Design: ATOMesh RL rollout control plane #77 draft verbatim; no line numbers or list counts in the docs.

…ds weight_version

Answers the review of #98 at 0a1ce4e: the PD mismatch path is its own
(_recompute_stale_remote_kv), set against the P/D receive abort rule; a
P/D engine refuses updates that would leave a stamp ambiguous; /model_info
and /generate read the version through a utility command and
RequestOutput; A9's fan-outs carry a selector; D4 is dropped for the
Ruling it restated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@junyyang-amd

Copy link
Copy Markdown
Owner Author

Round 2 pushed 968c6fe.

  • Mismatch path: fixed; a new _recompute_stale_remote_kv, set against the receive abort.
  • Version enforcer: fixed; P/D refuses unpaused or same-version updates, and resume after a version-less one.
  • A9 selector: fixed, engine=atom.
  • A8 decision: dropped, Ruling cited in A8.
  • Version reads: fixed; get_weight_version command, RequestOutput.weight_version.

task-77 @ 968c6fe: gate passed (black, ruff on changed lines, 13757 passed and 1477 skipped, mesh cargo tests ok).

| gRPC / ZMQ workers via `rl.control_url`, `RlControlCalls` | HTTP workers only; others answer `no_control_endpoint` | gRPC workers are a non-goal. |
| `smg_rl_*` metrics | None | No acceptance item reads them. |

ATOM engine routes against SGLang's (D4): `pause_generation` accepts only

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list of engine-route differences from SGLang omits the 400s the PD in-flight policy (rule 5) adds under P/D: an update while not paused, an update naming the version already held, and continue_generation while the version is stale. List them here and point to that policy.

@junyyang-amd

Copy link
Copy Markdown
Owner Author

APPROVE @ 968c6fe.

The five findings from the last round are fixed. One non-blocking finding is inline: the list of engine-route differences from SGLang leaves out the new P/D refusals.

Checked: 1 to 10 (detail below); gate passed at the head: black, ruff on changed lines, 13757 passed and 1477 skipped, mesh cargo tests ok.

Accepted with reservation: a stale stamp takes a local prefill on D, which departs from the abort rule for failed receives; the design names the conflict and bounds it by the requests in flight at the refit.

Watch next: the stale-stamp path must leave D's connector and pd_admission with nothing to release twice; rejected requests (FrontendHub._reject, CoreManager's terminal output) build a RequestOutput with no version; a refused update_weights_from_distributed leaves the trainer's broadcast with no receiver.

Checks
  1. No low entries; the stamp still beats drain and stampless recompute, and the new abort alternative fails A9's 0 failed.
  2. A diagram for each of A1 to A9; A9 now walks the mismatch to a local prefill on D under engine=atom.
  3. The named simpler design still fails A1, A8 and A9; mine matches this one.
  4. The stale-stamp prefill is set against _abort_failed_remote_receive and settled; nothing else conflicts.
  5. New code: bases hold at fork/RL 2f9d30a: _resolve_waiting_remote_kv and _update_waiting_for_remote_kv order, register_received_prefix, _uncount_inflight_load, BlockManager.deallocate, _consume_failed_remote_kv keeping the table, Mooncake clearing do_remote_prefill once the receive is queued (so readmission prefills locally), EngineCore.pause_generation, _engine_route relaying to the hub, broadcast_utility_command_sync returning replies in DP order, FrontendHub pickling outputs.
  6. Every decision has a basis; SMG examples/rl/refit_from_trainer.py: _stream_weights stamps only the last chunk, as rule 5 says.
  7. Within ATOMesh RL rollout control plane (pause / refit / resume, weight_version) #76; no requirement gap.
  8. Unchanged since the last round: spike results match Spike: does a second RCCL group with an external trainer work beside ATOM's TP group #91 and Spike: what happens to in-flight 1P1D requests when P and D are paused and their weights changed #92; no sync issue needed.
  9. 653 lines; the A8 decision with no rival is gone, and the new text is what the fixes need.
  10. Gate as above; the principles document and CLAUDE.md are unchanged; no line numbers or list counts in the docs.

@junyyang-amd
junyyang-amd merged commit 196ea4d into RL Nov 17, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-team/design Design task (agent-team)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant